package com.ssfeng.youxia.config;

import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.context.annotation.*;
import org.springframework.scheduling.annotation.EnableScheduling;

@Configuration
@ComponentScan({
		"com.ssfeng.youxia.services",
		"com.ssfeng.youxia.service",
		"com.ssfeng.youxia.aop",
		"com.ssfeng.youxia.bean"})
@EnableAspectJAutoProxy(proxyTargetClass=true)
@EnableScheduling
public class SpringRootConfig {

	
//	  @Bean //aop的第二种配置方式 
//	  public DemoAop getDemoAop(){ return new DemoAop(); }
	 
		@Bean(name = "lifecycleBeanPostProcessor")
		public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
			return new LifecycleBeanPostProcessor();
		}

	  
	@Bean
	@DependsOn("lifecycleBeanPostProcessor")
	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
		DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
		defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
		return defaultAdvisorAutoProxyCreator;
	}
}
